#include <fstream>
#include <vector>
#include <string>
#include <cmath>
#include "long_int_t.h"

int main()
{
   std::ifstream input("in.txt");
   std::ofstream output("out.txt");
   long_int_t a;
   long_int_t b;
   while (input >> a)
   {
      input >> b;
      if (b == 0)
      {
         output << "<error>\n";
      }
      else
      {
         std::pair<long_int_t, long_int_t> ans = a.divide_with_remainder(b);
         output << ans.first << "\n" << ans.second << "\n";
      }
      output << "\n";
   }
   return 0;
}